<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>深复制</title>
</head>
<body>
<script>
    function deepClone(obj){
       let objClone=Array.isArray(obj)?[]:{};
       if(obj && typeof obj==="object"){
           for(key in obj){
               if(obj.hasOwnProperty(key)){
                   if(obj[key]&&typeof obj[key]==="object"){
                       objClone[key] =deepClone(obj[key]);
                   }else{
                       objClone[key]=obj[key];
                   }
               }
           }
       }
    }
</script>
</body>
</html>